<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>sticky</title>

        <style>
            body{
                margin: 0;
                padding: 0;
            }
            .wrapper{
                width: 100%;
                height: 3000px;
                position: relative;
                font-size: 100px;
                text-align: center;
                line-height: 300px;
            }
            .block{
                width: 100%;
                height: 600px;
                position: relative;
            }
            .odd{
                background-color: gray;
            }
            .even{
                background-color: yellow;
            }
            .sticky{
                position: sticky;
                top: 0;
                left: 0;
                height: 100px;
                width: 100%;
                background-color: #1E9FFF;
                opacity: 0.5;
            }
        </style>
    </head>
    <body>

        <div class="wrapper">
            <div class="block odd">1</div>
            <div class="block even">2</div>
            <div class="block odd">3
                <div class="sticky"></div>
            </div>
            <div class="block even">4</div>
            <div class="block odd">5</div>
        </div>
        
    </body>
</html>